import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sgy_flutter/ble/ble_manager.dart';
import 'package:sgy_flutter/extensions/get.dart';
import 'package:sgy_flutter/gen/assets.gen.dart';
import 'package:sgy_flutter/model/device_type.dart';
import 'package:sgy_flutter/page/dfu/logic.dart';

/**
 * 老的版本才会进来这个页面
 */
class ChargingView extends GetView<DfuLogic> {
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        //AXO
        Visibility(
          visible: controller.bleManager.deviceModel?.deviceType == DeviceType.axo,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Assets.image.iconPowerUnconnect.image(width: 180),
              Assets.image.iconDown.image(width: 26),
              Assets.image.iconPowerConnect.image(width: 180),
              Text("请保持充电状态,LED灯常亮".tr),
              Assets.image.iconDown.image(width: 26),
              Container(
                padding: EdgeInsets.only(bottom: 20),
                width: double.infinity,
                child: FilledButton(
                    onPressed: () {
                      controller.checkCharging();
                    },
                    child: Text("下一步".tr)),
              ),
            ],
          ),
        ),
        //DLS
        Visibility(
          visible: controller.bleManager.deviceModel?.deviceType == DeviceType.dlsL ||
              controller.bleManager.deviceModel?.deviceType == DeviceType.dlsR,
          child: Column(
            // mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Assets.image.iconDlsLeft.image(width: 260).marginOnly(top: 60),

              Text("请保持充电状态,LED灯常亮".tr).marginOnly(top: 16, left: 16, right: 16),
              Spacer(),
              Container(
                padding: EdgeInsets.only(bottom: 20),
                width: double.infinity,
                child: FilledButton(
                    onPressed: () {
                      controller.checkCharging();
                    },
                    child: Text("下一步".tr)),
              ),
            ],
          ),
        ),
      ],
    );
  }
}
